<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button></button>
	<script>
		
		var a =prompt("请输入你的年龄");

		var btn = document.querySelector("button");

		btn.onclick = function(){
			
			a = Number(a);
 
			console.log(a);
		}
	</script>
	
</body>
</html>